API Documentation
Static Public Member Functions | List of all members
nkImages::JpgEncoder Class Referencefinal

Offers capabilities to encode and decode JPEG format. More...

Static Public Member Functions

static nkMemory::Buffer encode (const ImageView &image)
 
static bool canDecode (const nkMemory::BufferView< unsigned char > &data)
 
static Image decode (const nkMemory::BufferView< unsigned char > &data, const AlignmentDescriptor &alignmentDescriptor=AlignmentDescriptor())
 

Detailed Description

Offers capabilities to encode and decode JPEG format.

Member Function Documentation

◆ encode()

static nkMemory::Buffer nkImages::JpgEncoder::encode ( const ImageView image)
static

Encodes an image into a binary buffer fitting the Jpg format.

Parameters
imageThe image to encode.
Returns
The binary buffer holding the encoded image.
Remarks
This is currently WIP and will return an empty buffer.

◆ canDecode()

static bool nkImages::JpgEncoder::canDecode ( const nkMemory::BufferView< unsigned char > &  data)
static

Checks whether a binary buffer can be decoded by this encoder. This checks the data first and last bytes for the magic markers.

Parameters
dataThe binary data which need to be checked.
Returns
Whether the binary buffer can be decoded (true) or not (false).

◆ decode()

static Image nkImages::JpgEncoder::decode ( const nkMemory::BufferView< unsigned char > &  data,
const AlignmentDescriptor alignmentDescriptor = AlignmentDescriptor() 
)
static

Decodes a binary buffer into its image representation.

Currently supported features are :

  • YUV compressed as 4:4:4, 4:2:2, or 4:2:0 / monochromatic Y
  • Scan data encoding all channels at once
  • Baseline huffman encoding
  • No restart marker
Parameters
dataThe binary buffer to decode.
alignmentDescriptorIf decoded image's data needs to fit some alignment requirements, they can be specified through this parameter.
Returns
The decoded image, if data could be decoded.
Remarks
If something goes wrong, the error will be logged and an empty image will be returned.

The documentation for this class was generated from the following file: